package balmysundaycandy.morelowlevel.sample.controller.urlfetch;

import java.util.logging.Logger;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.util.BeanUtil;

import balmysundaycandy.morelowlevel.sample.controller.PathElement;
import balmysundaycandy.morelowlevel.sample.model.BlackScholesArgument;
import balmysundaycandy.morelowlevel.sample.services.BlackScholesCalcurationService;

public class IndexController extends Controller {

	Logger logger = Logger.getLogger(IndexController.class.getSimpleName());
	
	BlackScholesCalcurationService blackScholesCalcurationService = new BlackScholesCalcurationService();

	@Override
	protected Navigation run() {
		BlackScholesArgument blackScholesArgument = new BlackScholesArgument();
		BeanUtil.copy(request, blackScholesArgument);
		
        requestScope("bsnpv", blackScholesCalcurationService.npv(blackScholesArgument));		
       
		return forward(PathElement.JSP_PATH + "/urlfetch/index.jsp");
	}
}
